Potential fix for code scanning alert no. 19: Potentially overflowing call to snprintf#7
Draft
rzr wants to merge 5 commits into
Draft
Potential fix for code scanning alert no. 19: Potentially overflowing call to snprintf#7rzr wants to merge 5 commits into
rzr wants to merge 5 commits into
Conversation
Checking snprintf results, this was found using CodeQL Potential fix for code scanning alert no. 15: Potentially overflowing call to snprintf For the record this function escape the git commit to hex form (in ascii) Origin: SiliconLabsSoftware#104 Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Relate-to: SiliconLabsSoftware#100 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
This will align to SL policy Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
Also added comment to prevent privileges escalation using pull_request_target (see related change) Relate-to:SiliconLabsSoftware#67 Relate-to: https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/ Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
…call to snprintf Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
… call to snprintf Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
4f86970 to
e24a30e
Compare
7c4a093 to
cdc13a8
Compare
e7c64e2 to
a86e78d
Compare
01d2815 to
1df056b
Compare
eb732ac to
31cb0ba
Compare
f91d9c4 to
8dcfa6b
Compare
9490678 to
cd913ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/rzr/z-wave-protocol-controller/security/code-scanning/19
To fix the issue, we need to validate the return value of
snprintfafter each call. If the return value is negative or exceeds the remaining buffer size, we should stop further writes to prevent buffer overflow. This involves:snprintfin a variable.sizeof(message) - index).Suggested fixes powered by Copilot Autofix. Review carefully before merging.